package arithmetic;

import java.util.Scanner;

/**
 * @program: javaLearn
 * @description: 力扣旋转字符串
 * @author: renhai
 * @Date ：2022/4/7 22:20
 **/
public class RotationString {
    /**
     * 暴力解法
     *
     * @param s
     * @param goal
     * @return
     */
    public boolean rotateString(String s, String goal) {
        if (s.length() != goal.length()) {

            return false;
        } else {

            if (s.equals(goal)) {

                return true;
            } else {

                for (int i = 0; i < s.length() - 1; i++) {
                    if ((s.substring(i + 1) + s.substring(0, i + 1)).equals(goal)) {
                        return true;
                    }
                }
            }
        }
        return false;
    }

    public boolean rotateString1(String s, String goal) {
        return s.length() == goal.length() && (s + s).contains(goal);
    }


    public static void main(String[] args) {


    }
}